import { getlocalStorage, setlocalStorage } from "@/utils/localStorage";
import { Keys } from "@/utils/localStore_key";
import { defineStore } from "pinia";
import { ref } from "vue";
export const useAppStore=defineStore('app',()=>{
  const isRouterShow=ref(false)
    // 侧边栏状态
    const isHeadActive=ref(getlocalStorage(Keys.ISEADCTIVE) || false)
  //  侧边栏切换
    const handleSidebarStatus=()=>{
          isHeadActive.value=!isHeadActive.value
          setlocalStorage(Keys.ISEADCTIVE,isHeadActive.value)
    }
// 刷新方法
    const refreshCurrentPage = () => ( isRouterShow.value = !isRouterShow.value);

    return {
      isHeadActive,
      handleSidebarStatus,
      refreshCurrentPage,
      isRouterShow
    }
})
